package com.bps.zzant.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.multipart.MultipartFile;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

@Entity
@Table(name = "zzant_file")

public class ArtFile implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5550744828938284550L;

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "file_id", unique = true, nullable = false)
	private int fileId;
	
	@Column(name = "cus_id")
	private int customerId;
	
	@Column(name = "orders_id")
	private int ordersId;
	
	@Column(name = "file_type")
	private String fileType;
	
	@Column(name = "file_dir")
	private String fileDir;
	
	@Column(name = "file_name")
	private String fileName;
	
	@Column(name = "ink_notes")
	private String inkNotes;
	
	@Transient
    private byte[] bytes;
    
	
	public int getFileId() {
		return fileId;
	}

	public void setFileId(int fileId) {
		this.fileId = fileId;
	}

	public int getCustomerId() {
		return customerId;
	}

	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	public int getOrdersId() {
		return ordersId;
	}

	public void setOrdersId(int ordersId) {
		this.ordersId = ordersId;
	}

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public String getFileDir() {
		return fileDir;
	}

	public void setFileDir(String fileDir) {
		this.fileDir = fileDir;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getInkNotes() {
		return inkNotes;
	}

	public void setInkNotes(String inkNotes) {
		this.inkNotes = inkNotes;
	}

	public ArtFile(int customerId, int ordersId, String fileType,
			String fileDir, String fileName, String inkNotes) {
		this.customerId = customerId;
		this.ordersId = ordersId;
		this.fileType = fileType;
		this.fileDir = fileDir;
		this.fileName = fileName;
		this.inkNotes = inkNotes;
	}

	public ArtFile() {
		super();
		// TODO Auto-generated constructor stub
	}

	public byte[] getBytes() {
		return bytes;
	}

	public void setBytes(byte[] bytes) {
		this.bytes = bytes;
	}
	
	public String getByteArrayString()
	{
	   // return new String(this.bytes);
		return Base64.encode(this.bytes);
	}
	
}
